// 图片上传接口地址
export const uploadActionUrl =
  'http://localhost:19999/attach/upload'
// 高德地图key
export const amapKey = '调整成自己的高德key'
// 服务器URL
export const serverURL = 'http://localhost:19999'
// 设置token
export const setToken = (token) => sessionStorage.setItem('token', token)
// 获取token
export const getToken = () => sessionStorage.getItem('token')
// 存储
export const setStorage = (key, value) => {
  sessionStorage.setItem(key, value)
}
// 获取
export const getStorage = (key) => {
  return sessionStorage.getItem(key)
}
// 全局事件总线（简易实现）
export const globalEventBus = {
  events: {},
  on(event, handler) {
    if (!this.events[event]) this.events[event] = [];
    this.events[event].push(handler);
  },
  off(event, handler) {
    if (!this.events[event]) return;
    this.events[event] = this.events[event].filter(h => h !== handler);
  },
  emit(event, ...args) {
    if (!this.events[event]) return;
    this.events[event].forEach(handler => handler(...args));
  }
};
